//
//  SNShopActivitiesIconModel.m
//  app
//
//  Created by 王少宁 on 15/8/20.
//  Copyright (c) 2015年 hdaren. All rights reserved.
//

#import "SNShopActivitiesIconModel.h"

@implementation SNShopActivitiesIconModel

- (instancetype)initWithArray:(NSArray *)array
{
    if ([super initWithArray:array]) {
        
        if (array && array.count) {
            NSMutableArray * mutableArray = [NSMutableArray array];
            for (NSDictionary * dic in array) {
                SNShopActivitiesIconSubModel * model = [SNShopActivitiesIconSubModel modelWithDict:dic];
                [mutableArray addObject:model];
            }
            
            SNShopActivitiesIconSubModel * model = [[SNShopActivitiesIconSubModel alloc] init];
            model.act_id = @"0";
            model.name = @"联系物业";
            model.pic = @"...";
            model.width = @"105";
            model.height = @"105";
            model.intro = @"";
            model.icon_type = @"3";
            model.content = @"";
            
            [mutableArray addObject:model];
            
            _activitiesIconArray = mutableArray;
            
            self.rowNumber = 1;
            _linage = array.count % 4 == 0 ? array.count/4 : array.count/4 + 1;
            self.cellHeight = SCREEN_WIDTH / 720 * 215 * _linage;
        }
    }
    return self;
}

@end




@implementation SNShopActivitiesIconSubModel

- (instancetype)initWithDict:(NSDictionary *)dict
{
    if ([super init]) {
        _act_id = [dict[@"act_id"] stringValue];
        _name = dict[@"name"];
        _pic = dict[@"pic"];
        _width = [dict[@"width"] stringValue];
        _height = [dict[@"height"] stringValue];
        _intro = dict[@"intro"];
        _icon_type = dict[@"icon_type"];
        _content = dict[@"content"];
    }
    return self;
}

+ (instancetype)modelWithDict:(NSDictionary *)dict
{
    return [[self alloc] initWithDict:dict];
}

@end